/*
 * Copyright (c) 2012, 2021, daojian.co and/or its affiliates. All rights reserved.
 *
 */

package co.bugu.code.analysis.application.converter;

import co.bugu.code.analysis.infra.entity.Project;
import co.bugu.code.analysis.application.dto.ProjectDto;
import org.springframework.beans.BeanUtils;
/**
 * 数据转换类
 *
 * @author happy-coder
 * @version 1.0.0
 * @createdAt 2022-06-11 11:21:37
 * @updatedAt 2022-06-11 11:21:37
 */
public class ProjectConverter {
    public static ProjectDto entityToDto(Project entity) {
        if (null == entity) {
            return null;
        }
        ProjectDto res = new  ProjectDto();
        BeanUtils.copyProperties(entity, res);
        return res;

    }


    /*
    * 实现gitlab4j的Project对象转换为infra的Project对象
    * */
    public static Project convert(org.gitlab4j.api.models.Project project) {
        Project infraProject = new Project();
        BeanUtils.copyProperties(project, infraProject);
        infraProject.setProjectId(project.getId());
        return infraProject;
    }


}
